﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Timers;

namespace xhim.client.update_service
{
    public partial class ClientUpdateService : ServiceBase
    {
        private Timer _timer;
        public ClientUpdateService()
        {
            InitializeComponent();
        }


        protected override void OnStart(string[] args)
        {
            init();
        }

        protected override void OnStop()
        {
            _timer.Stop();
        }


        private void init()
        {
            _timer = new Timer();
            _timer.Interval = 10000;
            _timer.Elapsed += _timer_Elapsed;
            _timer.Enabled = true;
        }

        private void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Task.Run(() =>
            {
                string version = PlatformApiService.getVersion();
            });
        }
    }
}
